package rad.framework.uml2.classdiagram.providers;

import rad.framework.uml2.classdiagram.edit.parts.ActorNameEditPart;
import rad.framework.uml2.classdiagram.edit.parts.AssociationName2EditPart;
import rad.framework.uml2.classdiagram.edit.parts.AssociationName3EditPart;
import rad.framework.uml2.classdiagram.edit.parts.AssociationName4EditPart;
import rad.framework.uml2.classdiagram.edit.parts.AssociationName5EditPart;
import rad.framework.uml2.classdiagram.edit.parts.AssociationName6EditPart;
import rad.framework.uml2.classdiagram.edit.parts.AssociationName7EditPart;
import rad.framework.uml2.classdiagram.edit.parts.AssociationName8EditPart;
import rad.framework.uml2.classdiagram.edit.parts.AssociationName9EditPart;
import rad.framework.uml2.classdiagram.edit.parts.AssociationNameEditPart;
import rad.framework.uml2.classdiagram.edit.parts.ClassNameEditPart;
import rad.framework.uml2.classdiagram.edit.parts.DependencyNameEditPart;
import rad.framework.uml2.classdiagram.edit.parts.EnumerationLiteralEditPart;
import rad.framework.uml2.classdiagram.edit.parts.EnumerationNameEditPart;
import rad.framework.uml2.classdiagram.edit.parts.InterfaceNameEditPart;
import rad.framework.uml2.classdiagram.edit.parts.OperationEditPart;
import rad.framework.uml2.classdiagram.edit.parts.PropertyEditPart;
import rad.framework.uml2.classdiagram.edit.parts.UseCaseNameEditPart;
import rad.framework.uml2.classdiagram.part.UMLVisualIDRegistry;

import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.gmf.runtime.common.core.service.AbstractProvider;
import org.eclipse.gmf.runtime.common.core.service.IOperation;
import org.eclipse.gmf.runtime.common.ui.services.parser.GetParserOperation;
import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
import org.eclipse.gmf.runtime.common.ui.services.parser.IParserProvider;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.uml2.uml.UMLPackage;

/**
 * @generated
 */
public class UMLParserProvider extends AbstractProvider implements
		IParserProvider {

	/**
	 * @generated
	 */
	private IParser propertyProperty_2001Parser;

	/**
	 * @generated
	 */
	private IParser getPropertyProperty_2001Parser() {
		if (propertyProperty_2001Parser == null) {
			propertyProperty_2001Parser = createPropertyProperty_2001Parser();
		}
		return propertyProperty_2001Parser;
	}

	/**
	 * @generated
	 */
	protected IParser createPropertyProperty_2001Parser() {
		UMLStructuralFeatureParser parser = new UMLStructuralFeatureParser(
				UMLPackage.eINSTANCE.getNamedElement().getEStructuralFeature(
						"name")); //$NON-NLS-1$
		parser.setViewPattern("{0}");
		parser.setEditPattern("{0}");
		return parser;
	}

	/**
	 * @generated
	 */
	private IParser enumerationLiteralEnumerationLiteral_2002Parser;

	/**
	 * @generated
	 */
	private IParser getEnumerationLiteralEnumerationLiteral_2002Parser() {
		if (enumerationLiteralEnumerationLiteral_2002Parser == null) {
			enumerationLiteralEnumerationLiteral_2002Parser = createEnumerationLiteralEnumerationLiteral_2002Parser();
		}
		return enumerationLiteralEnumerationLiteral_2002Parser;
	}

	/**
	 * @generated
	 */
	protected IParser createEnumerationLiteralEnumerationLiteral_2002Parser() {
		UMLStructuralFeatureParser parser = new UMLStructuralFeatureParser(
				UMLPackage.eINSTANCE.getNamedElement().getEStructuralFeature(
						"name")); //$NON-NLS-1$
		parser.setViewPattern("{0}");
		parser.setEditPattern("{0}");
		return parser;
	}

	/**
	 * @generated
	 */
	private IParser operationOperation_2003Parser;

	/**
	 * @generated
	 */
	private IParser getOperationOperation_2003Parser() {
		if (operationOperation_2003Parser == null) {
			operationOperation_2003Parser = createOperationOperation_2003Parser();
		}
		return operationOperation_2003Parser;
	}

	/**
	 * @generated
	 */
	protected IParser createOperationOperation_2003Parser() {
		UMLStructuralFeatureParser parser = new UMLStructuralFeatureParser(
				UMLPackage.eINSTANCE.getNamedElement().getEStructuralFeature(
						"name")); //$NON-NLS-1$
		parser.setViewPattern("{0}");
		parser.setEditPattern("{0}");
		return parser;
	}

	/**
	 * @generated
	 */
	private IParser classClassName_4001Parser;

	/**
	 * @generated
	 */
	private IParser getClassClassName_4001Parser() {
		if (classClassName_4001Parser == null) {
			classClassName_4001Parser = createClassClassName_4001Parser();
		}
		return classClassName_4001Parser;
	}

	/**
	 * @generated
	 */
	protected IParser createClassClassName_4001Parser() {
		UMLStructuralFeatureParser parser = new UMLStructuralFeatureParser(
				UMLPackage.eINSTANCE.getNamedElement().getEStructuralFeature(
						"name")); //$NON-NLS-1$
		return parser;
	}

	/**
	 * @generated
	 */
	private IParser enumerationEnumerationName_4002Parser;

	/**
	 * @generated
	 */
	private IParser getEnumerationEnumerationName_4002Parser() {
		if (enumerationEnumerationName_4002Parser == null) {
			enumerationEnumerationName_4002Parser = createEnumerationEnumerationName_4002Parser();
		}
		return enumerationEnumerationName_4002Parser;
	}

	/**
	 * @generated
	 */
	protected IParser createEnumerationEnumerationName_4002Parser() {
		UMLStructuralFeatureParser parser = new UMLStructuralFeatureParser(
				UMLPackage.eINSTANCE.getNamedElement().getEStructuralFeature(
						"name")); //$NON-NLS-1$
		return parser;
	}

	/**
	 * @generated
	 */
	private IParser interfaceInterfaceName_4003Parser;

	/**
	 * @generated
	 */
	private IParser getInterfaceInterfaceName_4003Parser() {
		if (interfaceInterfaceName_4003Parser == null) {
			interfaceInterfaceName_4003Parser = createInterfaceInterfaceName_4003Parser();
		}
		return interfaceInterfaceName_4003Parser;
	}

	/**
	 * @generated
	 */
	protected IParser createInterfaceInterfaceName_4003Parser() {
		UMLStructuralFeatureParser parser = new UMLStructuralFeatureParser(
				UMLPackage.eINSTANCE.getNamedElement().getEStructuralFeature(
						"name")); //$NON-NLS-1$
		return parser;
	}

	/**
	 * @generated
	 */
	private IParser actorActorName_4004Parser;

	/**
	 * @generated
	 */
	private IParser getActorActorName_4004Parser() {
		if (actorActorName_4004Parser == null) {
			actorActorName_4004Parser = createActorActorName_4004Parser();
		}
		return actorActorName_4004Parser;
	}

	/**
	 * @generated
	 */
	protected IParser createActorActorName_4004Parser() {
		UMLStructuralFeatureParser parser = new UMLStructuralFeatureParser(
				UMLPackage.eINSTANCE.getNamedElement().getEStructuralFeature(
						"name")); //$NON-NLS-1$
		return parser;
	}

	/**
	 * @generated
	 */
	private IParser useCaseUseCaseName_4005Parser;

	/**
	 * @generated
	 */
	private IParser getUseCaseUseCaseName_4005Parser() {
		if (useCaseUseCaseName_4005Parser == null) {
			useCaseUseCaseName_4005Parser = createUseCaseUseCaseName_4005Parser();
		}
		return useCaseUseCaseName_4005Parser;
	}

	/**
	 * @generated
	 */
	protected IParser createUseCaseUseCaseName_4005Parser() {
		UMLStructuralFeatureParser parser = new UMLStructuralFeatureParser(
				UMLPackage.eINSTANCE.getNamedElement().getEStructuralFeature(
						"name")); //$NON-NLS-1$
		return parser;
	}

	/**
	 * @generated
	 */
	private IParser associationAssociationName_4006Parser;

	/**
	 * @generated
	 */
	private IParser getAssociationAssociationName_4006Parser() {
		if (associationAssociationName_4006Parser == null) {
			associationAssociationName_4006Parser = createAssociationAssociationName_4006Parser();
		}
		return associationAssociationName_4006Parser;
	}

	/**
	 * @generated
	 */
	protected IParser createAssociationAssociationName_4006Parser() {
		UMLStructuralFeatureParser parser = new UMLStructuralFeatureParser(
				UMLPackage.eINSTANCE.getNamedElement().getEStructuralFeature(
						"name")); //$NON-NLS-1$
		return parser;
	}

	/**
	 * @generated
	 */
	private IParser associationAssociationName_4007Parser;

	/**
	 * @generated
	 */
	private IParser getAssociationAssociationName_4007Parser() {
		if (associationAssociationName_4007Parser == null) {
			associationAssociationName_4007Parser = createAssociationAssociationName_4007Parser();
		}
		return associationAssociationName_4007Parser;
	}

	/**
	 * @generated
	 */
	protected IParser createAssociationAssociationName_4007Parser() {
		UMLStructuralFeatureParser parser = new UMLStructuralFeatureParser(
				UMLPackage.eINSTANCE.getNamedElement().getEStructuralFeature(
						"name")); //$NON-NLS-1$
		return parser;
	}

	/**
	 * @generated
	 */
	private IParser associationAssociationName_4008Parser;

	/**
	 * @generated
	 */
	private IParser getAssociationAssociationName_4008Parser() {
		if (associationAssociationName_4008Parser == null) {
			associationAssociationName_4008Parser = createAssociationAssociationName_4008Parser();
		}
		return associationAssociationName_4008Parser;
	}

	/**
	 * @generated
	 */
	protected IParser createAssociationAssociationName_4008Parser() {
		UMLStructuralFeatureParser parser = new UMLStructuralFeatureParser(
				UMLPackage.eINSTANCE.getNamedElement().getEStructuralFeature(
						"name")); //$NON-NLS-1$
		return parser;
	}

	/**
	 * @generated
	 */
	private IParser associationAssociationName_4009Parser;

	/**
	 * @generated
	 */
	private IParser getAssociationAssociationName_4009Parser() {
		if (associationAssociationName_4009Parser == null) {
			associationAssociationName_4009Parser = createAssociationAssociationName_4009Parser();
		}
		return associationAssociationName_4009Parser;
	}

	/**
	 * @generated
	 */
	protected IParser createAssociationAssociationName_4009Parser() {
		UMLStructuralFeatureParser parser = new UMLStructuralFeatureParser(
				UMLPackage.eINSTANCE.getNamedElement().getEStructuralFeature(
						"name")); //$NON-NLS-1$
		return parser;
	}

	/**
	 * @generated
	 */
	private IParser associationAssociationName_4010Parser;

	/**
	 * @generated
	 */
	private IParser getAssociationAssociationName_4010Parser() {
		if (associationAssociationName_4010Parser == null) {
			associationAssociationName_4010Parser = createAssociationAssociationName_4010Parser();
		}
		return associationAssociationName_4010Parser;
	}

	/**
	 * @generated
	 */
	protected IParser createAssociationAssociationName_4010Parser() {
		UMLStructuralFeatureParser parser = new UMLStructuralFeatureParser(
				UMLPackage.eINSTANCE.getNamedElement().getEStructuralFeature(
						"name")); //$NON-NLS-1$
		return parser;
	}

	/**
	 * @generated
	 */
	private IParser associationAssociationName_4011Parser;

	/**
	 * @generated
	 */
	private IParser getAssociationAssociationName_4011Parser() {
		if (associationAssociationName_4011Parser == null) {
			associationAssociationName_4011Parser = createAssociationAssociationName_4011Parser();
		}
		return associationAssociationName_4011Parser;
	}

	/**
	 * @generated
	 */
	protected IParser createAssociationAssociationName_4011Parser() {
		UMLStructuralFeatureParser parser = new UMLStructuralFeatureParser(
				UMLPackage.eINSTANCE.getNamedElement().getEStructuralFeature(
						"name")); //$NON-NLS-1$
		return parser;
	}

	/**
	 * @generated
	 */
	private IParser associationAssociationName_4012Parser;

	/**
	 * @generated
	 */
	private IParser getAssociationAssociationName_4012Parser() {
		if (associationAssociationName_4012Parser == null) {
			associationAssociationName_4012Parser = createAssociationAssociationName_4012Parser();
		}
		return associationAssociationName_4012Parser;
	}

	/**
	 * @generated
	 */
	protected IParser createAssociationAssociationName_4012Parser() {
		UMLStructuralFeatureParser parser = new UMLStructuralFeatureParser(
				UMLPackage.eINSTANCE.getNamedElement().getEStructuralFeature(
						"name")); //$NON-NLS-1$
		return parser;
	}

	/**
	 * @generated
	 */
	private IParser associationAssociationName_4013Parser;

	/**
	 * @generated
	 */
	private IParser getAssociationAssociationName_4013Parser() {
		if (associationAssociationName_4013Parser == null) {
			associationAssociationName_4013Parser = createAssociationAssociationName_4013Parser();
		}
		return associationAssociationName_4013Parser;
	}

	/**
	 * @generated
	 */
	protected IParser createAssociationAssociationName_4013Parser() {
		UMLStructuralFeatureParser parser = new UMLStructuralFeatureParser(
				UMLPackage.eINSTANCE.getNamedElement().getEStructuralFeature(
						"name")); //$NON-NLS-1$
		return parser;
	}

	/**
	 * @generated
	 */
	private IParser associationAssociationName_4014Parser;

	/**
	 * @generated
	 */
	private IParser getAssociationAssociationName_4014Parser() {
		if (associationAssociationName_4014Parser == null) {
			associationAssociationName_4014Parser = createAssociationAssociationName_4014Parser();
		}
		return associationAssociationName_4014Parser;
	}

	/**
	 * @generated
	 */
	protected IParser createAssociationAssociationName_4014Parser() {
		UMLStructuralFeatureParser parser = new UMLStructuralFeatureParser(
				UMLPackage.eINSTANCE.getNamedElement().getEStructuralFeature(
						"name")); //$NON-NLS-1$
		return parser;
	}

	/**
	 * @generated
	 */
	private IParser dependencyDependencyName_4015Parser;

	/**
	 * @generated
	 */
	private IParser getDependencyDependencyName_4015Parser() {
		if (dependencyDependencyName_4015Parser == null) {
			dependencyDependencyName_4015Parser = createDependencyDependencyName_4015Parser();
		}
		return dependencyDependencyName_4015Parser;
	}

	/**
	 * @generated
	 */
	protected IParser createDependencyDependencyName_4015Parser() {
		UMLStructuralFeatureParser parser = new UMLStructuralFeatureParser(
				UMLPackage.eINSTANCE.getNamedElement().getEStructuralFeature(
						"name")); //$NON-NLS-1$
		return parser;
	}

	/**
	 * @generated
	 */
	protected IParser getParser(int visualID) {
		switch (visualID) {
		case PropertyEditPart.VISUAL_ID:
			return getPropertyProperty_2001Parser();
		case EnumerationLiteralEditPart.VISUAL_ID:
			return getEnumerationLiteralEnumerationLiteral_2002Parser();
		case OperationEditPart.VISUAL_ID:
			return getOperationOperation_2003Parser();
		case ClassNameEditPart.VISUAL_ID:
			return getClassClassName_4001Parser();
		case EnumerationNameEditPart.VISUAL_ID:
			return getEnumerationEnumerationName_4002Parser();
		case InterfaceNameEditPart.VISUAL_ID:
			return getInterfaceInterfaceName_4003Parser();
		case ActorNameEditPart.VISUAL_ID:
			return getActorActorName_4004Parser();
		case UseCaseNameEditPart.VISUAL_ID:
			return getUseCaseUseCaseName_4005Parser();
		case AssociationNameEditPart.VISUAL_ID:
			return getAssociationAssociationName_4006Parser();
		case AssociationName2EditPart.VISUAL_ID:
			return getAssociationAssociationName_4007Parser();
		case AssociationName3EditPart.VISUAL_ID:
			return getAssociationAssociationName_4008Parser();
		case AssociationName4EditPart.VISUAL_ID:
			return getAssociationAssociationName_4009Parser();
		case AssociationName5EditPart.VISUAL_ID:
			return getAssociationAssociationName_4010Parser();
		case AssociationName6EditPart.VISUAL_ID:
			return getAssociationAssociationName_4011Parser();
		case AssociationName7EditPart.VISUAL_ID:
			return getAssociationAssociationName_4012Parser();
		case AssociationName8EditPart.VISUAL_ID:
			return getAssociationAssociationName_4013Parser();
		case AssociationName9EditPart.VISUAL_ID:
			return getAssociationAssociationName_4014Parser();
		case DependencyNameEditPart.VISUAL_ID:
			return getDependencyDependencyName_4015Parser();
		}
		return null;
	}

	/**
	 * @generated
	 */
	public IParser getParser(IAdaptable hint) {
		String vid = (String) hint.getAdapter(String.class);
		if (vid != null) {
			return getParser(UMLVisualIDRegistry.getVisualID(vid));
		}
		View view = (View) hint.getAdapter(View.class);
		if (view != null) {
			return getParser(UMLVisualIDRegistry.getVisualID(view));
		}
		return null;
	}

	/**
	 * @generated
	 */
	public boolean provides(IOperation operation) {
		if (operation instanceof GetParserOperation) {
			IAdaptable hint = ((GetParserOperation) operation).getHint();
			if (UMLElementTypes.getElement(hint) == null) {
				return false;
			}
			return getParser(hint) != null;
		}
		return false;
	}
}
